/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx.mapper;

import cn.webrx.entity.Book;
import org.apache.ibatis.annotations.*;


import java.util.List;
import java.util.Map;

/**
 * <p>Project: mybatis2022 - BookMapper
 * <p>Powered by webrx On 2022-04-11 14:09:46
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
@Mapper
public interface BookMapper {
    @Select("select id,name from book")
    List<Map<String,Object>> query();
    Book queryById(int id);
    int update(Book book);
    int update(Map<String,Object> map);
    @Update("update book set price = price + #{price} where 1=1")
    int updates(double price);

    @Insert("insert into book set id=#{id},name=#{name},author=#{author},price=#{price}")
    public int save(@Param("name")  String name,@Param("author")  String author,@Param("price")  double price);
    public int add(Map<String,Object> map);
    public int insert(Map<String,Object> map);
    @Insert("insert into book set id=#{id},name=#{name},author=#{author},price=#{price}")
    public int bookSave(Book book);

    @Delete("delete from book where id = #{id}")
    int deleteById(Integer id);
    @Delete("delete from book where name like #{name}")
    int deleteByName(String name);
    int deleteByIds(@Param("ids") int[] ids);
    int deleteByIdss(Map<String,Object> map);


    List<Book> selectList();
    List<Map<String,Object>> selectListMap();
    int count();
    String maxPrice();


}
